<?php
namespace App\Library\System\Model;

use App\Library\System\Model;

class OrganizationModel extends Model
{
    public function __construct($id)
    {
        parent::__construct();

        $org = $this->one($this->select()
                ->from('org')
                ->where(array(
                    'id' => $id
                ))
        );

        // Integrate user's informations into this object as properties
        if ($org) {
            $this->add($org);
        }
    }

    // User is valid ?
    public function isValid()
    {
        return isset($this->id) ? true : false;
    }

    public function getTitle()
    {
        return $this->name;
    }
}